package com.empire.module.member.dal.mysql.internetaccount;

import java.util.*;

import com.empire.framework.common.pojo.PageResult;
import com.empire.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.empire.framework.mybatis.core.mapper.BaseMapperX;
import com.empire.module.member.dal.dataobject.internetaccount.InternetAccountDO;
import org.apache.ibatis.annotations.Mapper;
import com.empire.module.member.controller.admin.internetaccount.vo.*;

/**
 * 互联网账号 Mapper
 *
 * @author 主席大人
 */
@Mapper
public interface InternetAccountMapper extends BaseMapperX<InternetAccountDO> {

    default PageResult<InternetAccountDO> selectPage(InternetAccountPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InternetAccountDO>()
                .betweenIfPresent(InternetAccountDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(InternetAccountDO::getAccountTypeId, reqVO.getAccountTypeId())
                .likeIfPresent(InternetAccountDO::getUsername, reqVO.getUsername())
                .eqIfPresent(InternetAccountDO::getUsernameId, reqVO.getUsernameId())
                .likeIfPresent(InternetAccountDO::getNickname, reqVO.getNickname())
                .eqIfPresent(InternetAccountDO::getUrl, reqVO.getUrl())
                .eqIfPresent(InternetAccountDO::getDescription, reqVO.getDescription())
                .eqIfPresent(InternetAccountDO::getEmail, reqVO.getEmail())
                .eqIfPresent(InternetAccountDO::getHeadPhotoUrl, reqVO.getHeadPhotoUrl())
                .eqIfPresent(InternetAccountDO::getHeadPhoto, reqVO.getHeadPhoto())
                .eqIfPresent(InternetAccountDO::getArticleCount, reqVO.getArticleCount())
                .eqIfPresent(InternetAccountDO::getFanCount, reqVO.getFanCount())
                .eqIfPresent(InternetAccountDO::getFanOtherCount, reqVO.getFanOtherCount())
                .eqIfPresent(InternetAccountDO::getLikedCount, reqVO.getLikedCount())
                .eqIfPresent(InternetAccountDO::getLikeCount, reqVO.getLikeCount())
                .eqIfPresent(InternetAccountDO::getLocation, reqVO.getLocation())
                .betweenIfPresent(InternetAccountDO::getJoinTime, reqVO.getJoinTime())
                .betweenIfPresent(InternetAccountDO::getCollectTime, reqVO.getCollectTime())
                .eqIfPresent(InternetAccountDO::getUserGenUuid, reqVO.getUserGenUuid())
                .eqIfPresent(InternetAccountDO::getPersonId, reqVO.getPersonId())
                .orderByDesc(InternetAccountDO::getId));
    }

}